package com.nf.practice.tomaptest;

import lombok.SneakyThrows;
import org.apache.commons.beanutils.BeanUtils;
import org.junit.jupiter.api.Test;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class ConvertToMap {


    @Test
    @SneakyThrows
    public void test() {//测试
        Person p = new Person();
        p.setName("Akili");
//        p.setSex(1);
//        p.setAge(24);
        p.setSchool("上海大学");
//        p.setHobby(new String[] { "摄影", "旅行", "家居", "做饭" });
//        p.setPlace(Lists.newArrayList("北京","深圳","广州","北海"));

        PersonData data = new PersonData();
        data.setPerson(p);
        Map<String, String> map = BeanUtils.describe(data);
        Map<String, Serializable> result = new HashMap<>();
        result.putAll(map);
        System.out.println(result);

    }
}
